In [1]:
from pytadbit.parsers.hic_parser import load_hic_data_from_reads
from cPickle import load
In [2]:
%matplotlib inline
In [4]:
reso = 300000
We don´t have normalized data at 300Kb resolution! then normalize again before finding compartments as follow
(*all previuos steps were done at 1Mb resolution)
In [5]:
hic_data1 = load_hic_data_from_reads(
'results/HindIII/03_filtering/valid_reads12_HindIII.tsv',
resolution= reso)
In [6]:
hic_data1.bias = load(open(
'results/HindIII/04_normalizing/biases_1000000_HindIII.pick'))
In [7]:
hic_data1.bads = load(open(
'results/HindIII/04_normalizing/bad_columns_1000000_HindIII.pick'))
In [8]:
hic_data2 = load_hic_data_from_reads(
'results/MboI/03_filtering/valid_reads12_MboI.tsv',
resolution= reso)
In [9]:
hic_data2.bias = load(open(
'results/MboI/04_normalizing/biases_1000000_MboI.pick'))
In [12]:
hic_data2.bads = load(open(
'results/MboI/04_normalizing/bad_columns_1000000_MboI.pick'))
In [10]:
hic_data1.normalize_hic()
iterative correction
- copying matrix
- computing baises
rescaling to factor 1
- getting the sum of the matrix
=> 11434.483
- rescaling biases
In [11]:
hic_data2.normalize_hic()
iterative correction
- copying matrix
- computing baises
rescaling to factor 1
- getting the sum of the matrix
=> 11340.756
- rescaling biases
In [13]:
hic_data = load_hic_data_from_reads(
'results/both/03_filtering/valid_reads12.tsv',
resolution=reso)
In [14]:
hic_data.normalize_hic()
iterative correction
- copying matrix
- computing baises
rescaling to factor 1
- getting the sum of the matrix
=> 11770.466
- rescaling biases
In [22]:
hic_data.find_compartments(crms=['chr18'], show=True,vmin=-0.2, vmax=0.2,
savedata='results/both/compartments.tsv',
savecorr='results/both/correlation.tsv')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/student/.miniconda2/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
305 pass
306 else:
--> 307 return printer(obj)
308 # Finally look for special method names
309 method = get_real_method(obj, self.print_method)
/home/student/.miniconda2/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in <lambda>(fig)
238
239 if 'png' in formats:
--> 240 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
241 if 'retina' in formats or 'png2x' in formats:
242 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
/home/student/.miniconda2/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in print_figure(fig, fmt, bbox_inches, **kwargs)
122
123 bytes_io = BytesIO()
--> 124 fig.canvas.print_figure(bytes_io, **kw)
125 data = bytes_io.getvalue()
126 if fmt == 'svg':
/home/student/.miniconda2/lib/python2.7/site-packages/matplotlib/backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2196 bbox_artists = kwargs.pop("bbox_extra_artists", None)
2197 if bbox_artists is None:
-> 2198 bbox_artists = self.figure.get_default_bbox_extra_artists()
2199
2200 bbox_filtered = []
/home/student/.miniconda2/lib/python2.7/site-packages/matplotlib/figure.pyc in get_default_bbox_extra_artists(self)
1690 bbox_artists.extend(ax.get_default_bbox_extra_artists())
1691 # we don't want the figure's patch to influence the bbox calculation
-> 1692 bbox_artists.remove(self.patch)
1693 return bbox_artists
1694
ValueError: list.remove(x): x not in list
<matplotlib.figure.Figure at 0x7f4559a70f90>
Out[22]:
{'chr18': [[-0.081888111507216935,
-0.071036889807485681,
-0.068068269297007392,
0.025106641239439141,
0.015439720764691776,
0.064365066702478241,
0.053922712166178048,
0.037333795395298186,
-0.0078276564254936808,
-0.086172495395762175,
-0.062398018720260455,
-0.06685085745094238,
-0.017055839120756512,
0.06534731346311938,
0.076244224133724031,
0.10207404710495825,
0.055636198699415516,
0.028392352062011249,
0.034492246185140185,
0.026988241516161617,
0.052193992637787699,
0.034403132125595141,
0.014770553660630131,
-0.00079336759500889579,
0.018916943615998577,
-0.027141694491228364,
0.014945477629151299,
-0.052609777716789118,
-0.054097132340415507,
-0.11001790517433276,
-0.043700030431959198,
-0.067293933180097382,
-0.07261647852133675,
-0.068642074636265871,
-0.050702637713482386,
-0.067751924744689287,
-0.034239852153351145,
0.017978149985738545,
-0.029517046219785369,
-0.061726992934160778,
-0.050014720864490998,
-0.073692194402218164,
-0.073413999806699923,
-0.069190364180130332,
-0.03945026666666402,
-0.010662266476176853,
0.037974349048376835,
0.047744840371572735,
0.077153133219442879,
0.072109812921722291,
0.081243700656133261,
0.059934955373669906,
0.026355827719494091,
nan,
nan,
nan,
nan,
nan,
nan,
-0.010903459864232036,
nan,
nan,
nan,
nan,
nan,
nan,
nan,
nan,
-0.015687574006787726,
-0.034893711320640355,
-0.060688553181766171,
-0.059874445386341915,
-0.069885676484755951,
-0.0531081119896245,
-0.093776232622837546,
nan,
nan,
-0.072547402050446103,
-0.082258296900923386,
-0.060448065910822503,
-0.015268190819856408,
0.016595999885487885,
0.059160072333041928,
0.014844287214886093,
-0.002511449728470571,
0.047306678990043469,
-0.010658129427402067,
0.001687021580981556,
0.00080382285741263161,
0.068623027971973005,
0.056426214463503967,
0.08119588537534124,
0.084650154485475013,
0.046321549723878058,
0.077025653205701372,
0.12923039617410889,
0.11167555307223212,
0.10220706958848079,
0.079358349527007849,
0.078195183043939229,
0.086724352461610393,
0.066109959013612316,
0.046670045611710703,
0.061393565555328197,
0.067191358293336625,
0.0021415975262522634,
0.01033193710314351,
0.029632345978118192,
0.068542287719443845,
0.099642480008050816,
0.11294109120144849,
0.10419462859869727,
0.10040491382695664,
0.10140342171197204,
0.11355949644444162,
0.10356505745919019,
0.039948175690949904,
-0.012732603314960556,
-0.010304376954708898,
0.016344653865539859,
-0.052734087716366826,
-0.018987762578771293,
-0.020016814106060783,
0.065728143034504943,
-0.011496790063274259,
0.030257144399701699,
0.047692870248362225,
0.10314223386059454,
0.083001305919853705,
0.11572740021102942,
0.095309780661998106,
0.092489174205048236,
0.068547333408037772,
0.094984064209281086,
0.086900204495844124,
0.11124467317474572,
0.10616449241345306,
0.089300616331375149,
0.11374256628473527,
0.032601414108557616,
0.060866059597124732,
0.07165792682451462,
0.073457968058961015,
0.11188118320944251,
0.097639049563252298,
0.081685634349378047,
0.074318961137122316,
0.10336492781816871,
0.078050798457869219,
0.047154100926780552,
0.07586064598514751,
0.012211589701494769,
0.0062515813347004305,
-0.046777995620163042,
-0.062805793016398812,
-0.040506289359056515,
-0.024745343441886475,
-0.062411190063955499,
-0.024855282352121023,
-0.042075671734880436,
-0.0092594743090331777,
-0.013675851007758172,
-0.093332409829039592,
-0.031244865946784328,
-0.069782567095370562,
-0.047297574685778263,
-0.017904946727175047,
-0.038625644791090444,
-0.021200878808684348,
-0.030537337470658982,
0.0014224035574432682,
0.043575695441980256,
0.10381414961754906,
0.093274693859686023,
0.10144149089426632,
0.10814242050516944,
0.103063709327085,
0.08736879949127685,
0.097947140521116888,
0.1051204133578086,
0.01542251457924166,
0.042606416210050943,
0.053718440628106996,
0.054018381709668328,
-0.012139755075410428,
-0.0093962884347374223,
0.059028940972522238,
0.053504652077177674,
-0.0094798300969345679,
-0.013645621991044774,
-0.012387939268660718,
-0.01554484825471792,
-0.063502444856186904,
-0.083827402158394279,
-0.067664009634945357,
-0.043095151503367679,
-0.01405319612580665,
-0.03737217696566926,
0.037592317613925265,
-0.0060365504368045733,
0.087185077238102551,
0.084601226585563613,
0.076618652454866834,
0.11139081727771898,
0.091204773085096044,
0.028463023759647009,
0.0062057125402791022,
-0.032514562108514986,
-0.054479043701717328,
-0.073919525710737274,
-0.022357809933073045,
-0.0050476530758448946,
0.068085499444058437,
0.10443551266135469,
0.085057123987485009,
0.028808343918950607,
0.082843938110511842,
0.089390556765472098,
0.073800273364757085,
0.026338397746991697,
0.062765962754330162,
0.096544828588404616,
0.049662273651369639,
0.076135786211311535,
0.058994240692710635,
0.063297139922409443,
0.075704635036542817,
0.071398896307029919,
0.043757116167386742,
0.015560590281718661,
0.073278668010898801,
0.087698155188115662,
0.071577891741787178,
-0.025588147527198631,
-0.019359646501760301,
0.057746344826647138,
0.084561313674883787,
0.057590155919909992,
0.067704182338412564,
0.071090297603972216,
0.086810604207302189,
0.11110312157958033,
0.044709696924737169,
0.056649064338387033,
0.0045606621007382398,
0.069344228083580553,
0.024956470756023568,
-0.04135457381374668,
-0.027682388923669265,
0.028996981372746318,
0.01221272514158051,
-0.010628181518063249,
0.042445200465254899,
0.042701266516230026,
-0.012970348149228919,
-0.035044442443292939,
-0.037427008742227888,
-0.019123185304896217,
0.043238558227759745,
0.0054700426978137959,
0.012571571751347491,
-0.052991327280627602,
-0.053410294919184913,
-0.035614901672362788,
-0.050583748538543832,
-0.059882353586619391,
-0.049720207226736798,
-0.057694275733469122,
nan],
[-0.051070339254391493,
-0.064536904926523905,
-0.041575684417241694,
-0.0012223433217578206,
-0.053548143628729616,
-0.028848718899486092,
0.007119199074840812,
-0.055442485314485604,
-0.0062289162751518945,
-0.032027298500288924,
0.027006520906199441,
0.037384279393691301,
-0.036532931924496859,
-0.031501050906100704,
0.0041384665005795209,
-0.0097858560004253099,
-0.080725283147462384,
-0.03174150610262743,
-0.023603619818997862,
-0.10605247800084239,
-0.0270437512642209,
-0.0920431010084891,
0.0064063591790309259,
-0.0098057372926680115,
0.011707023347569016,
-0.049762501660915504,
-0.037405201984127855,
-0.042475047743260448,
-0.058474996673789241,
-0.029613262777858883,
-0.0049410949973208553,
-0.01439053414054609,
-0.054488379883017357,
-0.058931145432804311,
-0.09946522854497078,
-0.092476387725159967,
-0.039029741946994739,
-0.051960590058568693,
-0.070403943806627081,
-0.12792140508174199,
-0.083758448228557672,
-0.11373696725899876,
-0.11063814228971985,
-0.024566234738958491,
-0.1158876513462915,
-0.099092768148818094,
-0.068020728330520336,
-0.019995997410811945,
0.0021077137098530953,
-0.014344809051213245,
0.015498607357623127,
0.0021641341900359638,
-0.011623915602014576,
nan,
nan,
nan,
nan,
nan,
nan,
-0.035168083537607871,
nan,
nan,
nan,
nan,
nan,
nan,
nan,
nan,
-0.050819005253339419,
-0.03753742987208495,
-0.11213861986388231,
-0.022939445185588395,
-0.066340867025918626,
-0.038737251258920302,
-0.064132221679841755,
nan,
nan,
-0.11075591392931271,
-0.0089473189984944582,
-0.090619338178019052,
-0.10084569129531445,
0.017863313378502166,
-0.0099388491812947757,
-0.027880671708610767,
-0.083923201308697445,
-0.0031524423194593037,
-0.036814786093859915,
-0.03352177938079786,
-0.067042091696881051,
-0.018034927076712622,
-0.022973349166938054,
-0.015426892735280359,
-0.013104852748135821,
-0.080537857119272763,
-0.049420657088916985,
0.010328117887279116,
0.017757525974973775,
0.0016509199837767862,
-0.0065771631214137762,
-0.0042877328020090155,
-0.027810806152438396,
-0.010754559405759411,
-0.0358501391340008,
-0.022207857901183108,
-0.052149226970699167,
-0.044399499064529974,
-0.10212617136100026,
-0.082759776610091887,
-0.074935517770388302,
-0.048987495593312731,
-0.020930866901032404,
-0.010512652630898572,
-0.0061622350497199437,
-0.065545570666542513,
-0.034170782833242243,
-0.032590552658257471,
-0.049589399802365652,
-0.11259434480027926,
-0.036388338891680742,
-0.11104803459786519,
-0.085189475411979937,
-0.14471203802925428,
-0.069468543866303245,
-0.043989633979542753,
-0.09205172516411099,
-0.063716019503345392,
-0.058281256470521278,
-0.010567045339352063,
-0.0016388547513852352,
-0.024001552928707121,
-0.0049707240924836806,
-0.059307017310831815,
-0.034553239829895561,
-0.041152828297146921,
-0.018339202256270979,
-0.028956947621795719,
0.015296162393090836,
0.020393822916806827,
0.038831168679840045,
0.037831319215268146,
-0.069249662032313614,
-0.067431351008743534,
-0.094762057362643287,
-0.018033575956876349,
-0.064634543437641301,
-0.050955991001031452,
-0.053935491294121618,
-0.091808277345938008,
-0.082071229063882575,
-0.14826830091618981,
-0.084795813883594764,
-0.19145669999481071,
-0.15378620812890137,
-0.12793022651095468,
-0.14629555999705163,
-0.1826256978035255,
-0.072784337784348077,
-0.13470542673321101,
-0.15004019475232236,
-0.10719126576149046,
-0.14803470122951781,
-0.12793487513904442,
-0.076499879867306442,
-0.067570862764567113,
-0.07975518319084951,
-0.14816512190083875,
-0.088396070771477889,
-0.07059306024496724,
-0.13720970389964693,
-0.050376143267281549,
-0.057881647213143358,
-0.081754900677235773,
0.004973274589914126,
-0.068377438289887127,
-0.062369935532775096,
-0.028135658535689372,
-0.015819531134327821,
-0.030031729092508053,
-0.082110033271708141,
-0.039758391649476373,
-0.064552607195349054,
-0.080704667070399097,
-0.057770167213419335,
-0.036148464610883467,
-0.042359699614473674,
-0.023946876046580329,
-0.10614163307642366,
-0.10025492913870966,
-0.060480406653978719,
-0.05757086664017199,
-0.058417980094024574,
-0.050107863727890278,
-0.06215000805075032,
-0.018230130840972716,
-0.094012784724246831,
-0.12243591336008969,
-0.068512913348677068,
-0.091362332331050997,
-0.027763393904565337,
-0.041275545910460801,
-0.022201314355719239,
-0.01382891424297108,
-0.053450032020894961,
-0.0094730897811097538,
-0.054375047460170113,
-0.069596465435412022,
-0.099058216531914656,
-0.04813321841948854,
-0.058521267210644018,
-0.060125274225132024,
-0.10098652379688897,
-0.091641598017199857,
-0.057935278552728932,
-0.064709885057562588,
-0.058096318037387379,
-0.085034501200534726,
0.00097671283473095517,
-0.0053727210780273463,
0.0079567157385460868,
-0.021087507798278657,
0.032270283593590965,
0.0187776363840053,
-0.037586441366268666,
-0.057186727054953923,
-0.036495583403807916,
0.020880577693275608,
0.030643579228765826,
-0.0075319414051238306,
-0.036812149572499224,
-0.049451408441817071,
-0.014790468193541927,
0.019024268704270441,
-0.0024444855254859474,
-0.082915997843909073,
-0.037565770343115125,
-0.037352234302829676,
-0.0082721571983747338,
0.0078764020129012055,
-0.039835616217463315,
0.0027153781030803525,
0.053083190204738062,
0.016952003440221991,
-0.01599165765877664,
0.0057143698814558453,
-0.022658406365323059,
-0.0059319401102638936,
-0.039665898232200313,
-0.032015764956643905,
-0.031448848250525185,
-0.020710523961267671,
-0.025467036317288756,
-0.016288225493699043,
0.00044761658361308323,
0.004224806598250589,
-0.034739955219501482,
-0.027690815149922342,
-0.038737836621969245,
-0.01294213056860084,
-0.010917114120783744,
-0.016561682937238108,
-0.021000553524574864,
-0.0098042906352864799,
-0.039174663504117101,
-0.021051489483694393,
-0.026256631066040533,
-0.0089509389991809189,
-0.068693134544291767,
-0.03365739429767374,
nan],
[0.17192651665503639,
0.0023266924807082007,
0.22132327660728746,
0.015885300030589591,
0.22299985320641938,
0.024534570130243072,
-0.061506017906427471,
-0.031210123838988482,
0.0014496984926566318,
-0.15222640366111323,
-0.0062567615491488301,
0.0045348988684780628,
-0.096534822670175074,
0.011273961560592405,
-0.00016681818594131703,
-0.012009755838201408,
-0.069172521968227402,
-0.0075014868770985066,
-0.03111909942142204,
-0.013982400930686336,
-0.072276831042753092,
0.0023244589544841876,
0.0030832124583142165,
0.00075379530699064225,
0.019077125377354325,
0.23341572529587654,
0.0053520702214704639,
0.012017197437727702,
0.017797292142159013,
-0.067588700827767634,
-0.012565565421201966,
-0.023831842463784079,
0.12256603004769366,
0.0075072546577265864,
-0.0058617341309371712,
-0.010590108954827877,
-0.074384573437690726,
0.026707359431726415,
-0.055805682537054466,
-0.13634814594904987,
0.13924916888874972,
-0.10495046851596704,
-0.055949808137673501,
0.0040448616256862913,
-0.14725992401751911,
-0.00037513062504298048,
0.030021176781350981,
-9.5337365603208324e-05,
0.010147613796706187,
0.018212451275186545,
-0.025109217938235368,
-0.0020903228715536681,
-0.011385705259618982,
nan,
nan,
nan,
nan,
nan,
nan,
-0.027195329163986065,
nan,
nan,
nan,
nan,
nan,
nan,
nan,
nan,
-0.01428574661574555,
0.024125077149814572,
0.0049614707027762425,
-0.0065381306755278173,
-0.060978465578267957,
0.00033161729431484266,
0.10022114614441892,
nan,
nan,
0.13772019481383568,
0.014606489590232724,
0.12895916578459524,
-0.076509603193842854,
0.010360291284193884,
-0.0011866607518402281,
-0.11276039506317743,
0.19078834564406708,
-0.06298549292389434,
-0.0077245629852291282,
0.029985195800707694,
0.2036980953371009,
0.013233687092692077,
0.022720836316884901,
0.022952194696204478,
0.022732789177103668,
-0.16993069217627527,
-0.066827341901469897,
0.0024494609254021027,
0.002890987727920305,
-0.024168412851510265,
-0.010303829936055262,
-0.0076624498434382654,
-0.0021165803823590679,
0.0033217996347931211,
0.022157350256211943,
0.014317779669732147,
-0.0091820389243938011,
-0.011399303629398356,
-0.025601887025454059,
0.17500259857902239,
-0.06702121473741586,
0.095934751262513801,
-0.022236335844223659,
-0.024786042648262757,
0.0067016890152540032,
-0.036112285599402438,
-0.0067621605707640225,
-0.00090903937307917904,
-0.016656725564274034,
-0.0076006719772946799,
-0.050437224159950805,
-0.03677116195549178,
0.17517615607815012,
-0.09560544916661369,
0.039127293139210317,
0.031110859849129771,
0.086550283174975262,
-0.0070778877502231351,
0.09385233942474451,
-0.018717126662005479,
-0.012625922615823487,
0.0014801810977398827,
0.0077517095038728834,
0.010276201515787231,
0.068896293455310537,
0.0201972514038814,
-0.00060510057503278258,
-0.0055423387740246993,
0.0033101418287914131,
0.0039763161867645835,
0.0078569135262093609,
-0.0010172828070539111,
-0.023525977949803899,
0.011565849451979644,
-0.012134319465092094,
0.023723818124789117,
-0.0010269330826353229,
-0.046478955459081039,
0.021981328512136591,
-0.044655785270956844,
0.13699158372652895,
0.0089648737192351557,
-0.005497844534888302,
0.014041774274771246,
-0.034995408422911288,
-0.071055202194700823,
-0.16129323658360917,
-0.074669460986837105,
-0.033107189381699147,
0.12659019370403463,
0.1371637144516199,
-0.039945544352284437,
0.0086015514647067044,
-0.012783918035255465,
-0.15392747948548408,
-0.044376084002388877,
-0.13190126337107574,
-0.097622354450027621,
0.0048206452698915207,
-0.023011176878270735,
0.18229729922399932,
-0.025468877300171826,
-0.031392501955754624,
-0.033267676938168504,
-0.025131492587640983,
0.082079101359392795,
0.033162426895763319,
0.011010562934460885,
0.0028704249523413689,
0.004581131658924098,
0.010190208793582553,
-0.0072421549817053843,
0.030841709188178634,
5.3233144599415527e-05,
0.079678444420256747,
0.083812984983188579,
-0.0088535579369054974,
-0.0048491063632603313,
0.0055241844877947713,
-0.015165044348802129,
0.12070527296020984,
-0.048251357821331525,
-0.01024780926125678,
-0.020117649033081313,
-0.055115258816552715,
0.061443760432814215,
-0.021877948727792862,
0.13472305594449785,
-0.021344843539013739,
-0.013661079220211036,
-0.012517821613850212,
0.011703934492471313,
-0.022180329770319446,
0.08321512548642726,
-0.093017448567998928,
0.0033511234275490076,
0.080488671455643326,
-0.011856489696626022,
-0.082783004169613567,
0.04411441749841287,
-0.055374505532668039,
0.032351453261456956,
-0.097060004538529351,
-0.012630498047006507,
-0.0057889086681528895,
-0.02255070297378084,
-0.028049175364221357,
-0.075809524307693513,
-0.021871912745938485,
0.045571337695509258,
0.10168344803988388,
-0.042082654049391779,
0.021302907093816201,
-0.0086453917456482815,
-0.003116773431155212,
-0.037687327050552444,
-0.012729241784171161,
-0.0085966360603578346,
0.0085020793352403867,
-0.023319127183603988,
-0.0028326245960259497,
0.051136332411701214,
-0.025505090287907359,
0.0024830918002511637,
-0.0085267945009587925,
0.060001561085639102,
-0.031118064777457512,
-0.072275187895101817,
-0.012527790910129705,
0.015146852048948022,
-0.05421955047994198,
-0.025636785761427791,
0.005254802830939001,
-0.015786044374258998,
-0.0099221839950124902,
0.00066788757293985423,
0.03923313361075606,
-0.0013164922468909546,
-0.0015538209644736165,
0.035451438679036398,
0.016072589778069978,
-0.04192676408738439,
-0.041176712591083478,
-0.016515848131512918,
0.011812272218066425,
-0.00029485568724271077,
-0.017262843042118104,
-0.0071270480699786934,
-0.014465821932150021,
-0.0074268408419010373,
0.0092482609679389247,
0.030923506986363102,
-8.339287472705452e-05,
0.0061113685717557112,
-0.012088444834066729,
0.023104435926248119,
-0.0012420907310692897,
0.022779055172907119,
0.01957323073567914,
-0.023925563272137025,
nan]]}
In [27]:
corr
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-27-2598043ab093> in <module>()
----> 1 corr
NameError: name 'corr' is not defined
In [ ]:
Content source: 4DGenome/Chromosomal-Conformation-Course
Similar notebooks: